import React from "react"
import {getaudio} from "./api"
import './list.css'
class Ado extends React.Component{
    constructor(){
        super()
        this.state={
            data:[]
        }
    }
    ren(){
        this.props.history.go(-1)
    }
    
    componentDidMount(){
        console.log(this.props)
        getaudio()
        .then(res=>{
            // console.log(res)
            this.setState({
                data:res.djRadios
            })
        })
    }
    render(){
        let {data} = this.state
        // console.log(data)
        return(
            <div id="list">
                <h3 onClick={this.ren.bind(this)}>
                <img src={require('../../imgs/back.png')}/>
                    返回</h3>
                <ul>
                    {data.map(item=><li key={item.id}>
                        <img src={item.picUrl}/><br/>
                        <span>{item.name}</span>
                    </li>)}
                </ul>
            </div>
        )
    }
}


export default Ado